import request from '@/router/axios';

/**
 * 获取列表
 * @param current
 * @param size
 * @param params
 * @returns {*}
 */
export const getEntityList = (current, size, params) =>{
  return request({
    // url: '/api/beetles-business/finance/invoiceEntity/page',
    url: '/api/beetles-business/finance/invoiceEntity/entityPage',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/**
 * 新增/修改
 * @param data
 * @returns {*}
 */
export const addEntity = (data) =>{
  return request({
    url:'/api/beetles-business/finance/invoiceEntity/save',
    method:'post',
    timeout: 3600 * 1000,
    data
  })
}

/**
 * 删除
 * @param data
 * @returns {*}
 */
export const removeEntity = (data) =>{
  return request({
    url:'/api/beetles-business/finance/invoiceEntity/remove',
    method:'post',
    params:{
      ids:data
    }
  })
}

/**
 * 更新
 * @param data
 * @returns {*}
 */
export const updateEntity = (data) =>{
  return request({
    url:'/api/beetles-business/finance/invoiceEntity/update',
    method:'post',
    data
  })
}

export const getCustomerDetail = (id) => {
  return request({
    url: '/api/beetles-business/customer/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const getEntityListByCustomer = (customerId) => {
  return request({
    url: '/api/beetles-business/finance/invoiceEntity/list',
    method: 'get',
    params: {
      customerId
    }
  })
}


//过滤已存在的发票实体客户
export const filterEntityCustomer = () => {
  return request({
    url: '/api/beetles-business/finance/invoiceEntity/filter-entity-customer',
    method: 'get',
  })
}
